package com.project.service.impl;



import com.project.bean.InfoBean;
import com.project.bean.MQBean;
import com.project.remoteService.IInfoService;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.support.AmqpHeaders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.stereotype.Service;

import java.io.IOException;

@Service
public class RabbitMQService {

  @RabbitListener(queues = "infoQueue")
  public void message(Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag, MQBean infoBean) throws IOException {
    //手动确认
    channel.basicAck(tag,true);

  }

}
